package util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @classname:MD5Util
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/29 23:24
 * @version: 0.1
 * @since:1.8
 */
public class MD5Util {
    private MD5Util() {
    }

    private static final String SALT = "javaAm";

    public static String passMd5(String str) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            str = str + SALT;
            md5.update(str.getBytes());
            byte[] digest = md5.digest();
            return new BigInteger(1, digest).toString(16).toUpperCase();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return null;

    }
}
